package com.cqut.forum.aspect.imp;

import javax.annotation.Resource;

import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import com.cqut.forum.aspect.PictureAspect;
import com.cqut.forum.entity.FaceWall;
import com.cqut.forum.entity.Picture;
import com.cqut.forum.service.WallService;

/**
 * picutreAspect 实现类
 * @author yangxun
 *
 */
@Aspect
@Component
public class PictureAspectImp implements PictureAspect {

	@Resource
	private WallService wallService;
	@Override
	public void deletePictureAspect(Picture picture) {
		if(picture==null){
			return;
		}
		FaceWall faceWall = wallService.getByPictureAddress(picture.getPictureAddress());
		if(faceWall==null){
			return;
		}
		wallService.delete(faceWall.getWallId());
	}

}
